package com.hermeneute.fsa.editors.scanners;

import org.eclipse.jface.text.rules.*;

public class FSAPartitionScanner extends RuleBasedPartitionScanner {
	public final static String FSA_COMMENT = "__fsa_comment";
	public final static String FSA_AUTOMATON = "__fsa_automaton";
	public final static String FSA_EPRODUCTION = "__fsa_eproduction";
	public final static String FSA_STRING = "__fsa_string";

	public FSAPartitionScanner() {

		IToken fsaComment = new Token(FSA_COMMENT);
		IToken fsa = new Token(FSA_AUTOMATON);
		IToken eproduction = new Token(FSA_EPRODUCTION);
		IToken fsaString = new Token(FSA_STRING);

		IPredicateRule[] rules = new IPredicateRule[4];

		rules[0] = new SingleLineRule("#", "", fsaComment);
		rules[1] = new SingleLineRule("<", ">", fsa);
		rules[2] = new SingleLineRule("0:\"","\"",eproduction,'\\');
		rules[3] = new SingleLineRule("\"","\"",fsaString,'\\');

		setPredicateRules(rules);
	}
}
